
#include "BotBody.h"

uint32 GetTimeMS()
{
#ifdef WIN32
	return GetTickCount();
#else
	struct timeb tp;
	ftime(&tp);
	return tp.time * 1000 + tp.millitm;
#endif
}

int main(int argc, char* argv[])
{
	printf("begin..\n");
	BotBody body;

	printf("init..\n");
	body.Init();

	time_t timeNow = GetTimeMS();
	time_t timePre;
	bool bEnd = false;
	printf("do while..\n");
	while( !bEnd )
	{
		timePre = timeNow;
		timeNow = GetTimeMS();
		//printf("%d,%d \n",int(timePre),int(timeNow));
		time_t timeDiff = timeNow-timePre;
		body.Update( timeDiff );

		if( timeDiff < 30 )
		{
			Sleep( 30 - timeDiff );
		}
		//printf("Update %d",int(timeDiff));
	}
	return 0;
}


void OnCrash(bool Terminate)
{

}
